package com.nbsaas.boot.order.rest.resource;

import com.nbsaas.boot.order.api.apis.OrderStatisticsApi;
import com.nbsaas.boot.order.data.entity.OrderStatistics;
import com.nbsaas.boot.order.api.domain.request.OrderStatisticsRequest;
import com.nbsaas.boot.order.api.domain.response.OrderStatisticsResponse;
import com.nbsaas.boot.order.api.domain.simple.OrderStatisticsSimple;
import com.nbsaas.boot.order.rest.convert.OrderStatisticsSimpleConvert;
import com.nbsaas.boot.order.rest.convert.OrderStatisticsEntityConvert;
import com.nbsaas.boot.order.rest.convert.OrderStatisticsResponseConvert;
import com.nbsaas.boot.order.data.repository.OrderStatisticsRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   订单统计-业务接口实现
*/
@Transactional
@Service
public class OrderStatisticsResource extends BaseResource<OrderStatistics,OrderStatisticsResponse, OrderStatisticsSimple, OrderStatisticsRequest>  implements OrderStatisticsApi {

    @Resource
    private OrderStatisticsRepository orderStatisticsRepository;

    @Override
    public JpaRepositoryImplementation<OrderStatistics, Serializable> getJpaRepository() {
        return orderStatisticsRepository;
    }

    @Override
    public Function<OrderStatistics, OrderStatisticsSimple> getConvertSimple() {
        return new OrderStatisticsSimpleConvert();
    }

    @Override
    public Function<OrderStatisticsRequest, OrderStatistics> getConvertForm() {
        return new OrderStatisticsEntityConvert();
    }

    @Override
    public Function<OrderStatistics, OrderStatisticsResponse> getConvertResponse() {
        return new OrderStatisticsResponseConvert();
    }




}


